package com.designschool.activity;

import com.designschool.base.activity.BaseActivity;
import com.designschool.base.activity.DesignSchoolApplication;
import com.designschool.base.view.LoadingImageView;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;

public class MainActivity extends BaseActivity {
	
	private LoadingImageView iv_images;
	private ImageView iv_img;

	@Override
	public void setContentView() {
		setContentView(R.layout.activity_main);
	}

	@Override
	public void initViews() {
		iv_images=(LoadingImageView)findViewById(R.id.iv_images); 
	}

	@Override
	public void initDatas() { 
		iv_img=iv_images.getiv_loading();
		//ImageLoader.getInstance().displayImage(uri, imageView, options, listener, progressListener);
		ImageLoader.getInstance().displayImage("http://www.vvvpic.com/upload/images/ppt/114/573459609fde3_1024.jpg", iv_img,null,new ImageLoadingListener() { 
			@Override
			public void onLoadingStarted(String arg0, View arg1) { 
				
			}
			
			@Override
			public void onLoadingFailed(String arg0, View arg1, FailReason arg2) {  
			}
			
			@Override
			public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) {  
			}
			
			@Override
			public void onLoadingCancelled(String arg0, View arg1) {  
			}
			
		},new ImageLoadingProgressListener() { 
			@Override
			public void onProgressUpdate(String arg0, View arg1,  int current, int total) { 
				Log.e("current---total--->", current+"---"+total);
				iv_images.setProgressBarMax(total);
				iv_images.setProgress(current);
			}
		});
		LayoutParams params=iv_img.getLayoutParams();
		params.width=DesignSchoolApplication.width;
		params.height=params.width;
	}

	@Override
	public void setDatas() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setListener() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void ResumeDatas() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
	}

	
 
}
